<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>实验室开放设置</title>
<style type="text/css">
body{
font-size:12px;
}
table td{
height:30px;
border:solid 1px #B7D0E8;
}

.title{
width:200px;
text-align: center;
}
.tableTitle{
width:90px;
height: 40px;
line-height:40px;
text-align:center;
background-color: #E8F5FE;
margin-top: 10px;
}
table{
background-color:#F7F7FF;
width:100%;
border: 2px solid #BDDFE7;
border-collapse: collapse;
}
input{
text-align: center;
}
#courseList{
	padding-left:78px;
	font-weight:bold;
}
</style>
<script type="text/javascript">
 

function saveForm(){
	 $.ajax({
		 datatype:'json',
         cache: true,
         type: "POST",
         url:'labOpenController.do?addOpenConfig',
         data:$('#form').serialize(),// 你的formid
         async: false,
         error: function(request) {
             alert("Connection error");
         },
         success: function(data) {
        	 data = $.parseJSON(data);
             tip(data.msg);
             if(data.success){
               window.location.href="labOpenController.do?list";            	 
             }
         }
     }); 
}

function back(){
	window.location.href="labOpenController.do?list";
}

function stuSelect(iframe){
	var name =  iframe.getstudentListSelections("realName")[0];
	var id = iframe.getstudentListSelections("id")[0];
	
	if(id.length > 10){
		$('#stuList').append(name+"&nbsp;&nbsp;");
 		$('#form').append("<input type='hidden' name='studentId'  value='"+id+"'>");
	} 
}

function lessonSelect(iframe){
	/* var name =  iframe.getstudentListSelections("lessonName")[0];
	var id = iframe.getstudentListSelections("id")[0];
	
	if(id.length > 10){
		$('#stuList').append(name+"&nbsp;&nbsp;");
 		$('#form').append("<input type='hidden' name='studentId'  value='"+id+"'>");
	} */
	
	var names = iframe.getlessonListSelections("lessonName");
	var ids = iframe.getlessonListSelections("id");

	if(ids.length > 0){
		$('#courseList').html("");
		$('#lessonIds').val('');
	}else{
		return;
	}
	
	for(var i=0;i<names.length;i++){
		$('#courseList').append(names[i]+"&nbsp;&nbsp;");
	}
	
	var idValue = "";
	for(var i=0;i<ids.length;i++){
		idValue += ids[i];
		idValue +=",";
	}
	$('#lessonIds').val(idValue);
}

 

</script>

</head>
<body style="width:100%;height: 100%">
 <form id="form" method="post" >
 <input name="labId" type="hidden" value="${lab.id}"/>
  <div style="margin-top: 20px;">
<div class="tableTitle">实验室信息</div>
<table>
 <tr>
   <td class="title">实验室</td>
   <td>${lab.name }</td>
   <td class="title">所在学院</td>
   <td>${lab.college.collegeName}</td>
 </tr>
 <tr>
   <td class="title">管理员</td>
   <td>${lab.teacher.realName}</td>
   <td class="title">地址</td>
   <td>${lab.address}</td>
 </tr>
</table>

<div class="tableTitle">开放时间</div>
<table>
 <tr>
   <td class="title">开放时间段</td>
   <td colspan="2">
     <table style="border:0;" class="noborder">
       <tr>
         <td style="border:0;">
           <table style="border:0;" class="noborder">
             <tr>
               <td style="border-top:0;width:40px;border-left:0;border-bottom:0;text-align: center;">周期</td>
               <td style="border-top:0;border-right:0;">
               	&nbsp;<input id="beginDate" name="beginDate" value="${lab.beginDate }"  datatype="*" type="text" style="width: 100px" class="inputxt" onClick="WdatePicker()">-
               	<input id="endDate" name="endDate" value="${lab.endDate }" datatype="*" type="text" style="width: 100px" class="inputxt" onClick="WdatePicker()">
               </td>
             </tr>
              <tr>
               <td style="border-left:0;border-bottom:0;text-align: center;">星期</td>
               <td style="border-top:0;border-right:0;">
               <input type="checkbox" name="weeek" value="1" <c:if test="${lab.sun == '1' }">checked="checked"</c:if> />星期日
               <input type="checkbox" name="weeek" value="2" <c:if test="${lab.mon == '1' }">checked="checked"</c:if> />星期一
               <input type="checkbox" name="weeek" value="3" <c:if test="${lab.tue == '1' }">checked="checked"</c:if> />星期二
               <input type="checkbox" name="weeek" value="4" <c:if test="${lab.wed == '1' }">checked="checked"</c:if> />星期三
               <input type="checkbox" name="weeek" value="5" <c:if test="${lab.thu == '1' }">checked="checked"</c:if> />星期四
               <input type="checkbox" name="weeek" value="6" <c:if test="${lab.fri == '1' }">checked="checked"</c:if> />星期五
               <input type="checkbox" name="weeek" value="7" <c:if test="${lab.sat == '1' }">checked="checked"</c:if> />星期六
               </td>
             </tr>
             <tr>
               <td style="border-left:0;border-bottom:0;text-align: center;">时段</td>
               <td style="border-top:0;border-right:0;" id="duration"> 
               	<input type="checkbox" name="lessonOrder" value="1"   />第1节
               	<input type="checkbox" name="lessonOrder" value="2"   />第2节
               	<input type="checkbox" name="lessonOrder" value="3"   />第3节
               	<input type="checkbox" name="lessonOrder" value="4"   />第4节 
               	<input type="checkbox" name="lessonOrder" value="5"   />第5节
               	<input type="checkbox" name="lessonOrder" value="6"   />第6节
               	<input type="checkbox" name="lessonOrder" value="7"   />第7节
               	<input type="checkbox" name="lessonOrder" value="8"   />第8节
               	<input type="checkbox" name="lessonOrder" value="9"   />第9节
               	<input type="checkbox" name="lessonOrder" value="10"   />第10节
               	<input type="checkbox" name="lessonOrder" value="11"   />第11节 
               </td>
             </tr>
             <tr>
               <td style="border-left:0;border-bottom:0;text-align: center;">座位</td>
               <td style="border-top:0;border-right:0;border-bottom:0;">
                 <input type="checkbox" name="seat" value="Car" checked="checked" />全部开放
               </td>
             </tr>
           </table>
         </td> 
       </tr>
       <tr>
         <td style="border-bottom:0;border-left: 0;text-align: center;">暂无数据（此处用于选择座位）</td>
         <td style="border-bottom:0;"></td>
       </tr>
     </table>
   </td>
 </tr>
</table>
<%-- <div class="tableTitle">开放对象</div>
<table style="width:100%;border: 2px solid #BDDFE7;border-collapse: collapse" >
 <tr>
   <td class="title">开放对象</td>
   <td style="width:150px">
	   <input type="radio"  datatype="*"  name="openObect" value="0" <c:if test="${lab.openObect == '0' }">checked="true"</c:if> />全部开放
	   <input type="radio" name="openObect" value="1" <c:if test="${lab.openObect == '1' }">checked="true"</c:if> />指定范围
   </td>
   <td>
   		<input id="teacherId" name="teacherId" type="hidden"  value='${task.teacher.id }'>               
		 
		<t:choose hiddenName="teacherId" hiddenid="id" url="studentController.do?goSelect" name="studentList" width="450px"
                         icon="icon-search" title="选择"  isclear="false" isInit="true" fun="stuSelect"  ></t:choose>
   </td>
 </tr>
 <tr>
 <td colspan="3" id="stuList"></td>
 </tr>
</table> --%>


<div class="tableTitle">开放课程</div>
<table style="width:100%;border: 2px solid #BDDFE7;border-collapse: collapse" >
 <tr>
   <td class="title">开放课程</td>
   
   <td>
   		<input id="lessonIds" name="lessonIds" type="hidden"  value='${lessonIds}'>               
		 
		<t:choose hiddenName="teacherId" hiddenid="id" url="lessonInfoController.do?goSelect" name="lessonList" width="450px"
                         icon="icon-search" title="选择"  isclear="false" isInit="true" fun="lessonSelect"  ></t:choose>
   </td>
 </tr>
 <tr>
 <td colspan="3" id="courseList">${lessonNames}</td>
 </tr>
</table>

<div class="tableTitle">收费标准</div>
<table style="width:100%;border: 2px solid #BDDFE7;border-collapse: collapse" >
 <tr>
   <td class="title">收费标准</td>
   <td>
   &nbsp;&nbsp;<input type="text" name="price"  value="${lab.price}" style="width:50px;"/>元
   <select name="priceUnit">
     <option value="1" <c:if test="${lab.priceUnit == '1' }">checked="true"</c:if>>天</option>
     <option value="2" <c:if test="${lab.priceUnit == '2' }">checked="true"</c:if>>小时</option>
     <option value="3" <c:if test="${lab.priceUnit == '3' }">checked="true"</c:if>>年</option>
     <option value="4" <c:if test="${lab.priceUnit == '4' }">checked="true"</c:if>>次</option>
   </select>
   </td>
 </tr>
 <tr>
   <td class="title">收费方式</td>
   <td>
    <input type="radio"  datatype="*"  name="priceType" value="0" <c:if test="${lab.priceType == '0' }">checked="true"</c:if> />根据预约收费
    <input type="radio" name="priceType" value="1" <c:if test="${lab.priceType == '1' }">checked="true"</c:if>/>根据使用收费
    <input type="radio" name="priceType" value="2" <c:if test="${lab.priceType == '2' }">checked="true"</c:if>/>最少根据预约收费
   </td>
 </tr>
</table>
<div class="tableTitle">开放参数</div>
<table style="width:100%;border: 2px solid #BDDFE7;border-collapse: collapse" >
 <tr>
   <td class="title">是否允许参观</td>
   <td colspan="5">
   &nbsp;&nbsp;<input type="checkbox" name="allowSee" value="1"  <c:if test="${lab.allowSee == '1' }">checked="checked"</c:if>/>
   </td>
 </tr>
 <tr>
   <td class="title">审批方式</td>
   <td>
    <input type="radio"  name="auditType" value="0" <c:if test="${lab.auditType == '0' }">checked="checked"</c:if>/>自动
    <input type="radio" name="auditType" value="1" <c:if test="${lab.auditType == '1' }">checked="checked"</c:if>/>管理员审核
   </td>
   <td class="title">自动审批时间</td>
    <td>
    <input type="text"  name="autoAuditBeginDate" style="width:50px" value="${lab.autoAuditBeginDate}"/>-
    <input type="text"  name="autoAuditEndDate"   style="width:50px" value="${lab.autoAuditEndDate}"/>
   </td>
   <td class="title">自动审批规则</td>
   <td>
    <input type="checkbox"  name="auditRule" value="1" <c:if test="${lab.feastAuditRule == '1' }">checked="checked"</c:if> />节假日自动
    <input type="checkbox" name="restAuditRule" value="1" <c:if test="${lab.restAuditRule == '1' }">checked="checked"</c:if> />双休日自动
   </td>
 </tr>
 <tr>
    <td class="title">预约取消时间</td>
   <td>
     <input type="text" style="width:50px;" name="auditCancelDate" value="${lab.auditCancelDate}"/>小时
   </td>
   <td class="title">开放最低人数</td>
   <td>
     <input type="text" style="width:50px;" name="minOpenPeople" value="${lab.minOpenPeople}"/>
   </td>
    <td class="title">最多可容纳人数</td>
   <td>
     <input type="text" style="width:50px;" name="maxOpenPeople" value="${lab.maxOpenPeople}"/>
   </td>
 </tr>
 <tr>
    <td class="title">关闭时间</td>
   <td>
     <input type="text" style="width:50px;" name="closeTime" value="${lab.closeTime}"/>点
   </td>
   <td class="title">最少的预约时间段</td>
   <td>
     <input type="text" style="width:50px;" name="minAppointDuration" value="${lab.minAppointDuration}"/>分钟
   </td>
    <td class="title">最大的预约时间段</td>
   <td>
     <input type="text" style="width:50px;" name="maxAppointDuration" value="${lab.maxAppointDuration}"/>分钟
   </td>
 </tr>
 <tr>
    <td class="title">预约的自动取消时间</td>
   <td>
     <input type="text" style="width:50px;" name="autoAppointCancelTime" value="${lab.autoAppointCancelTime}"/>
   </td>
   <td class="title">最大可预约的天数</td>
   <td>
     <input type="text" style="width:50px;" name="maxAppointDay" value="${lab.maxAppointDay}"/>天
   </td>
    <td class="title">最大预约天数中可预约几次</td>
   <td>
     <input type="text" style="width:50px;" name="maxAppointDayinAppoint" value="${lab.maxAppointDayinAppoint}"/>次
   </td>
 </tr>
  <tr>
   <td class="title">备注<br>
  <span style="color:red;"> (在预约单的头部显示)</span>
   </td>
   <td colspan="5">
   &nbsp;&nbsp;<textarea cols="120" rows="8" name="remark">${lab.remark}</textarea>
   </td>
 </tr>
</table>
<div style="width:100%;height: 30px;line-height: 30px;text-align: center;margin-top: 10px">
<div style="width:100px;margin-left: auto;margin-right: auto;">
  <div style="float:left;color:white;background-color: #0E8ECB;width:40px;cursor:pointer;" onclick="saveForm()">保存</div>
  <div style="float:right;color:white;background-color: #0E8ECB;width:40px;cursor:pointer;" onclick="back()">返回</div>
</div>

</div>
</div>
  
 </form>


</body>
</html>